<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

<script type="text/javascript">
	var djConfig = {isDebug: true, debugAtAllCosts: true };
</script>
<script type="text/javascript" src="../../../dojo.js"></script>
<script type="text/javascript">

	dojo.require("dojo.widget.*");
	dojo.require("dojo.widget.TreeV3");
	dojo.require("dojo.widget.TreeRpcControllerV3");
	dojo.require("dojo.widget.TreeContextMenuV3");
	dojo.require("dojo.widget.TreeDemo");
	dojo.require("dojo.widget.TreeEditor");
	dojo.hostenv.writeIncludes();
</script>


</head>
<body>

<h4>Every action on node is done with RpcController. ContextMenu, Dnd on.</h4>

<script>
	dojo.addOnLoad(function() { dojo.widget.TreeDemo.bindDemoMenu(dojo.widget.byId('treeController')) });

	function testCreateChild() {
		var parent = dojo.widget.byId('firstTree').children[0];
		dojo.debug("parent "+parent);

		var controller = dojo.widget.byId('treeController');

		controller.createChild(parent, 0, {objectId:5});
	}
</script>



<div dojoType="TreeContextMenuV3" toggle="explode" contextMenuForWindow="false" widgetId="contextMenu">
	<div dojoType="TreeMenuItemV3" treeActions="addChild" iconSrc="../images/createsmall.gif" widgetId="treeContextMenuCreate" caption="Create"></div>
	<div dojoType="TreeMenuItemV3" treeActions="remove" iconSrc="../images/removesmall.gif" caption="Remove" widgetId="treeContextMenuDestroy"></div>
	<div dojoType="TreeMenuItemV3" treeActions="move" iconSrc="../images/downsmall.png" caption="Up" widgetId="treeContextMenuUp"></div>
	<div dojoType="TreeMenuItemV3" treeActions="move" iconSrc="../images/upsmall.png" caption="Down" widgetId="treeContextMenuDown"></div>
	<div dojoType="TreeMenuItemV3" treeActions="edit" caption="Edit" widgetId="treeContextMenuEdit"></div>
    <div dojoType="TreeMenuItemV3" treeActions="refresh" caption="Refresh children" widgetId="treeContextMenuRefresh"></div>
</div>




<div dojoType="TreeEditor" widgetId="editor"></div>
<div dojoType="TreeRpcControllerV3" widgetId="treeController" RpcUrl="rpc.php" editor="editor"></div>


<h4>firstTree</h4>


<div dojoType="TreeV3" allowAddChildToLeaf="false" listeners="treeController;contextMenu" widgetId="firstTree">
    <div dojoType="TreeNodeV3" title="Item 1">
        <div dojoType="TreeNodeV3" title="Item 1.1"></div>
        <div dojoType="TreeNodeV3" title="Item 1.2">
            <div dojoType="TreeNodeV3" title="Item 1.2.1"></div>
            <div dojoType="TreeNodeV3" title="Item 1.2.2"></div>
        </div>
        <div dojoType="TreeNodeV3" title="Can't add child to this node" actionsDisabled="ADDCHILD">
            <div dojoType="TreeNodeV3" isFolder="true" title="Infinite folder"></div>
            <div dojoType="TreeNodeV3" title="Item 1.3.2"></div>
        </div>
        <div dojoType="TreeNodeV3" title="Item 1.4">
            <div dojoType="TreeNodeV3" title="Item 1.4.1"></div>
        </div>
	<div dojoType="TreeNodeV3" actionsDisabled="MOVE" title="Can't move this node"></div>
    </div>
</div>

<input type="button" onClick="testCreateChild()" value="createChild for top node">


</body>
</html>
